package com.mmall.common;

import com.alibaba.fastjson.JSONObject;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class test {

    //判断是否为质数
    public  static boolean judge(int num){



        double sqrt=Math.sqrt(num);
        if (num<2){
            return  true;
        }
        if (num==2||num==3){
            return  true;
        }
        //质数只能被1和它本书相除
        for(int i=2;i<=sqrt;i++){
            if(num%i==0){
                return  false;

            }

        }
    return true;
    }

    public static void main(String[] args) {


        List list=new ArrayList();
       // JsonObject jsonObject=new JsonObject();

//        jsonObject.addProperty("ss",new JsonObject().addProperty("s1",new JsonObject().addProperty("ss2","ddd")));
//        System.out.println("请输入数字");
       // jsonObject.addProperty("attr",new JsonObject().addProperty("service",new JsonObject().addProperty("output","25")));

        JSONObject jsonObject=new JSONObject();
        jsonObject.put("attr",new JSONObject().put("sercie",list));
        List<Integer> shuzis=new ArrayList<>();
        Scanner in=new Scanner(System.in);

        int shuzi=in.nextInt();
        if (shuzi!=0){
            shuzis.add(shuzi);
        }

        while (shuzi!=0){
            int shuzi2=in.nextInt();
            if (shuzi2!=0){
                shuzis.add(shuzi2);
            }
            shuzi=shuzi2;
        }

        for (int i=0;i<shuzis.size();i++){
            System.out.println(total(shuzis.get(i)));
        }
        System.out.println("end");
    }


    //一共可以分解成多少个质数相加
    public  static  int total(int num){
        int sum=0;
        for(int i=2;i<=num/2;i++){
            if(judge(i)&&judge(i-1)){
                sum=sum+1;
            }

        }
        return sum;
    }

}
